package cn.virens.web.components.shiro;

import org.apache.shiro.subject.Subject;

public interface ShiroRealmInterface {
	/**
	 * 清空授权缓存
	 * 
	 * @param principal 用户账号
	 */
	void clearAuthorizationInfo(String principal);

	/**
	 * 清空 授权缓存
	 * 
	 * @param subject 用户令牌
	 */
	default void clearAuthorizationInfo(Subject subject) {
		clearAuthorizationInfo(String.valueOf(subject.getPrincipal()));
	}

	/**
	 * 清空 认证缓存
	 * 
	 * @param principal 用户账号
	 */
	void clearAuthenticationInfo(String principal);

	/**
	 * 清空 认证缓存
	 * 
	 * @param subject 用户令牌
	 */
	default void clearAuthenticationInfo(Subject subject) {
		clearAuthenticationInfo(String.valueOf(subject.getPrincipal()));
	}

}
